package com.service.impl;

import com.dao.TypeDao;
import com.dao.impl.TypeDaoImpl;
import com.entity.Message;
import com.entity.Type;
import com.service.TypeService;
import com.utils.Constants;

import java.sql.SQLException;
import java.util.List;

/**
 * @ProjectName: shop
 * @Author: Jsx
 * @Time: 2020/8/30 20:01
 * @Description:
 */
public class TypeServiceImpl implements TypeService {
    @Override
    public Message findTypes() throws SQLException {

        TypeDao typeDao = new TypeDaoImpl();

        //最多截取6个
        List<Type> types = typeDao.queryTypes(6);
        Message message = new Message();

        if (types != null & types.size()>0) {
            message.setCode(Constants.MESSAGE_SUCCESS);
            message.setData(types);
        }

        return message;
    }
}
